import os
import sys


class CreateCatalog(object):
    def __init__(self, path):
        self.path = path

    def run(self):
        # 遍历所有的文件名
        paths = os.listdir(self.path)
        file = sys.argv[1] + '\MP3目录.txt'
        print(file)
        with open(file, 'w') as f:
            for path in paths:
                f.write(path)
                f.write('\n')
                # print(path)


if __name__ == '__main__':
    path = sys.argv[1]
    create_catalog = CreateCatalog(path)
    create_catalog.run()
